<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="java.util.*, java.text.*" %>
<%@ page import="com.google.appengine.api.users.*" %>
<%@ page import="com.google.appengine.api.datastore.*" %>    
<%
	int projectId = request.getParameter("projectId")==null?0:Integer.parseInt(request.getParameter("projectId")); 	//프로젝트 ID
	int issueId = request.getParameter("issueId")==null?0:Integer.parseInt(request.getParameter("issueId"));		//이슈 ID
    UserService userService = UserServiceFactory.getUserService();
    User user = userService.getCurrentUser();
    
    SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
%>    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>이슈 상세</title>
</head>
<body>
<%
    DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
	Key issueKey = KeyFactory.createKey(KeyFactory.createKey("issue", projectId), "issue", issueId);
	
	Entity issue = datastore.get(issueKey);	
	User frstRegisterUser = (User) issue.getProperty("frstRegisterUser");
	
	out.println(issue.getProperty("issueSj"));
	out.println("<br>");
	out.println(frstRegisterUser.getNickname());
	out.println("<br>");
	out.println(formatter.format((Date)issue.getProperty("frstRegistPnttm")));
	out.println("<br>");
	out.println(issue.getProperty("issueCn"));
%>
<br>
<a href="issueList.jsp?projectId=<%=projectId%>">목록</a>

<%if(frstRegisterUser.equals(user)) { %>
<a href="issueForm.jsp?projectId=<%=projectId%>&issueId=<%=issueId%>">수정</a>
<a href="issueList.jsp?projectId=<%=projectId%>">삭제</a>
<%} %>

</body>
</html>